<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <title>大朴 后台管理</title>
    <meta charset="UTF-8">
    <script src="__ROOT__/Admin/Common/js/angular.min.js"></script>
    <script src="__ROOT__/Admin/Common/js/jquery-3.2.1.min.js"></script>
    <style type="text/css" rel="stylesheet">
        html,body{width:100%;height:100%;margin:0;padding:0;font-family:"lucida grande", "lucida sans unicode", lucida, helvetica, "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;}
        .header{height:40px;width:100%;background-color:#242424;position:fixed;}
        .header_title{line-height:40px;margin-left:60px;color:#fff;font-size:15px;}
        .header_user{font-size:12px;margin-left:20px;color:#ccc;}
        .panel{width:380px;height:500px;margin-left:auto;margin-right:auto;padding-top:100px;font-size:14px;}
        a{text-decoration: none;color:#fff;}
        .login_input>span{display: inline-block;width:50px;}
        input{height:28px;line-height:28px;width:300px;border:1px solid #ddd; border-radius:4px;margin-left:5px;margin-bottom:10px;outline: none;padding-left:10px;}
    </style>
    
</head>
<body>
    <div class="header">
        <div class="header_title"><a href="/">后台管理系统</a></div>
    </div>
    <div class="panel" ng-controller="myController" ng-app="myApp">
        <div class="login_input">
            <span>用户名</span>
            <input  placeholder="请输入用户名" ng-model="username"/>
        </div>
        <div class="login_input">
            <span>密码</span>
            <input  type="password" placeholder="请输入密码" ng-model="pwd"/>
        </div>
        <div id="btn"  style="background-color:#3C74F2;width:306px;height:32px;line-height:32px;text-align: center;color:#fff;border-radius:4px;margin-top:30px;margin-left:60px;" ng-click="sub()">
            登录
        </div>
    </div>
    
</body>
<script>
	var app = angular.module("myApp",[]);
    app.controller("myController",function($scope,$http){
    		$scope.username="";
    		$scope.pwd="";
        
        $scope.sub=function(){
        		//触发ajax发送用户名密码验证
        		$http({
        			url:"__URL__/checkUsers",
        			method:"POST",
        			headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        			data: "username="+$scope.username+"&pwd="+$scope.pwd
        		}).success((res)=>{
        			if(res.status==1){
        				//跳转页面
        				window.location.href="__URL__/index";
        			}else{
        				alert(res.info)
        			}
        		}).error((err)=>{
        			console.log(err);
        		})
//			var url = "__URL__/post";
//			fetch(url,{
//      			method: "POST",
//				headers: {'Content-Type': 'application/x-www-form-urlencoded'},
//				body: "username="+$scope.userinfo.username+"&pwd="+$scope.userinfo.pwd
//      		}).then(function(res){
//      			return res.json();
//      		}).then(function(data){
//      			if(data==1){
//      				alert("登陆成功");
//      				self.location='__URL__/index'; 
//      			}else{
//      				alert("账号或者密码错误，请重新输入!")
//      			}
//      		}).catch(function(err){
//      			return console.log(err);
//      		})
        }
    })	
	
</script>

</html>